


	function mousemove() {
		$('.container_left_top').mousemove(function (e) {
			$('b').show();
			$('.big').show();
			var L = e.pageX;
			var l = $(this).offset().left;
			var left = L - l - 50;
			var T = e.pageY;
			var t = $(this).offset().top;
			var top = T - t - 50;
			left = left < 0 ? 0 : left;
			left = left > 300 ? 300 : left;
			top = top < 0 ? 0 : top;
			top = top > 300 ? 300 : top;
			$('b').css({left: left, top: top});
			var imgLeft = -left * 2;
			var imgTop = -top * 2;
			imgLeft = imgLeft < -400 ? -400 : imgLeft;
			imgTop = imgTop < -400 ? -400 : imgTop;
			$('.big img').css({left: imgLeft, top: imgTop});
		});

		$('.container_left_top').mouseout(function () {
			$('.container_left_top b').hide();
			$('.big').hide();
		});
	}

//用户浏览小图自动切换成为大图
	function changImg(e) {
		document.getElementById("big1").attributes["src"].value = e.attributes["src"].value;
	}

	function load(){
		var sessionStorage=window.sessionStorage;
		var goodDetail = sessionStorage.getItem("goodDetail");
		goodDetail = JSON.parse(goodDetail).data;
		//填充商品数据
		var imgDiv = $("#container_left .container_left_top");
		var img = document.createElement("img");
		img.setAttribute("id","big1");
		img.src = "/upload/image/"+goodDetail.image_urls;
		img.onmousemove = function(){mousemove();}
        imgDiv.append(img);

		//图片数据
		var imageData = goodDetail.image_urls;
		var imagesArray = new Array;
		imagesArray = imageData.split("#");

		img = document.createElement("img");
		img.setAttribute("id","big2");
		img.src = "/upload/image/"+imagesArray[0];
        $("#container_left .big").append(img);

		var img1 = document.createElement("img");
		img1.src = "/upload/image/"+imagesArray[0];
		img1.onmousemove = function(){changImg(this);}

		var img2 = document.createElement("img");
		img2.src = "/upload/image/"+imagesArray[1];
		img2.onmousemove = function(){changImg(this);}

		var img3 = document.createElement("img");
		img3.src = "/upload/image/"+imagesArray[2];
		img3.onmousemove = function(){changImg(this);}

		var img4 = document.createElement("img");
		img4.src = "/upload/image/"+imagesArray[3];
		img4.onmousemove = function(){changImg(this);}

		$("#container_left_bottom").append('<span id="director_left">&lt;</span>')
			.append(img1).append(img2).append(img3).append(img4)
			.append('<span id="director_right">&gt;</span>');


		$("#description").html(goodDetail.description);
		$("#brief").html(goodDetail.brief);
		$("#number").html("商品编码："+goodDetail.number);
		$("#price .font3").html("￥ "+goodDetail.price);
		$("#comment .font4").html("(共有"+goodDetail.comment.size()+"条评价)");
		$("#hot").html("人气："+goodDetail.hot);
		$("#number").html("商品编码："+goodDetail.number);
		$("#price .font3").html("￥ "+goodDetail.price);

		sessionStorage.removeItem("goodDetail");

	}

	function descrease(value){
		if(value>0){
			value = value-1;
		}else{
			value = 0;
		}
		$("#inventory").val(value);
	}